﻿Imports StedySoft.SenseSDK
Public Class frmDebug


    Dim objSep1 As New SensePanelDividerItem

    Dim objLat As New SensePanelItem
    Dim objLon As New SensePanelItem
    Dim objHead As New SensePanelItem
    Dim objAlt As New SensePanelItem
    Dim objSea As New SensePanelItem
    Dim objTime As New SensePanelItem

    Dim objSep2 As New SensePanelDividerItem

    Dim objDist As New SensePanelItem
    Dim objSpeed As New SensePanelItem
    Dim objSatCount As New SensePanelItem
    Dim objAcc As New SensePanelTrackbarItem
    Dim objSig As New SensePanelTrackbarItem

    Dim objSep3 As New SensePanelDividerItem

    Dim objLitres As New SensePanelItem
    Dim objCost As New SensePanelItem

    Private Sub frmDebug_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        objSep1.Text = "Raw"
        objSep2.Text = "Position"
        objSep3.Text = "Cost"

        objLat.PrimaryText = "Latitude"
        objLon.PrimaryText = "Longitude"
        objHead.PrimaryText = "Heading"
        objAlt.PrimaryText = "Altitude"
        objSea.PrimaryText = "Sea Level"
        objTime.PrimaryText = "Time"
        objDist.PrimaryText = "Distance"
        objSpeed.PrimaryText = "Speed"
        objSatCount.PrimaryText = "Sat Count"
        objLitres.PrimaryText = "Litres (ml)"
        objCost.PrimaryText = "Cost (LL)"

        objAcc.Text = "Accuracy"
        objSig.Text = "Signal Strenght"

        lstMain.AddItem(objSep1)
        lstMain.AddItem(objLat)
        lstMain.AddItem(objLon)
        lstMain.AddItem(objHead)
        lstMain.AddItem(objAlt)
        lstMain.AddItem(objSea)
        lstMain.AddItem(objTime)
        lstMain.AddItem(objSep2)
        lstMain.AddItem(objDist)
        lstMain.AddItem(objSpeed)
        lstMain.AddItem(objAcc)
        lstMain.AddItem(objSig)
        lstMain.AddItem(objSatCount)
        lstMain.AddItem(objSep3)
        lstMain.AddItem(objLitres)
        lstMain.AddItem(objCost)

    End Sub

    <CLSCompliant(False)> _
    Public Sub Push(ByVal GPosition As Microsoft.WindowsMobile.Samples.Location.GpsPosition)
        Try

            Glob.DistanceCalc.Push(GPosition)
            Glob.FuelConsumption.Distance = Glob.DistanceCalc.Distance
            objLitres.SecondaryText = Glob.FuelConsumption.Litres
            objCost.SecondaryText = Glob.FuelConsumption.Cost

            Dim objPosition As New clsPosition(GPosition)

            objLat.SecondaryText = GPosition.Latitude
            objLon.SecondaryText = GPosition.Longitude
            objHead.SecondaryText = GPosition.Heading
            objAlt.SecondaryText = GPosition.EllipsoidAltitude
            objSea.SecondaryText = GPosition.SeaLevelAltitude
            objTime.SecondaryText = GPosition.Time
            objDist.SecondaryText = Glob.DistanceCalc.Distance
            objSpeed.SecondaryText = objPosition.Speed
            objSatCount.SecondaryText = objPosition.SatCount

            objAcc.Value = objPosition.PositionAccuracy
            objSig.Value = objPosition.SignalStrength
        Catch ex As Exception
            sHeader.Text = ex.Message
        End Try
    End Sub

End Class